package vista;
import java.awt.event.ActionListener;
import java.util.List;

import javax.swing.ComboBoxModel;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
import javax.swing.JComboBox;

import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.SwingUtilities;

import javax.swing.WindowConstants;
import javax.swing.table.AbstractTableModel;




/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class VistaPuntuaciones extends javax.swing.JFrame {
	private JLabel lblTitulo;
	private JPanel jPanelPuntuaciones;
	private JScrollPane jTablePuntuaciones;
	private JTable tblPuntuaciones;
	private JComboBox jcmbNiveles;
	private JButton jbtnSalir;
	private JLabel jlblNiveles;

	public VistaPuntuaciones() {
		super();
		initGUI();
	}
	
	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			getContentPane().setLayout(null);
			getContentPane().setBackground(new java.awt.Color(255,255,255));
			setTitle("Puntuaciones del Buscaminas");
			{
				lblTitulo = new JLabel();
				getContentPane().add(lblTitulo);
				lblTitulo.setText("Puntuación de los mejores jugadores");
				lblTitulo.setFont(new java.awt.Font("DejaVu Sans",1,16));
				lblTitulo.setBounds(51, 19, 342, 32);
			}
			{
				jPanelPuntuaciones = new JPanel();
				getContentPane().add(jPanelPuntuaciones);
				jPanelPuntuaciones.setBounds(35, 128, 381, 152);
				jPanelPuntuaciones.setLayout(null);
				{
					jTablePuntuaciones = new JScrollPane();
					jPanelPuntuaciones.add(jTablePuntuaciones);
					jTablePuntuaciones.setBounds(0, 0, 381, 151);
					{
						tblPuntuaciones = new JTable();
						jTablePuntuaciones.setViewportView(tblPuntuaciones);
						tblPuntuaciones.setBounds(0, -13, 378, 191);
						tblPuntuaciones.setPreferredSize(new java.awt.Dimension(378, 148));
					}
				}
			}
			{
				ComboBoxModel jcmbNivelesModel = 
					new DefaultComboBoxModel(
							new String[] { "Basico", "Intermedio","Avanzado","Personalizado" });
				jcmbNiveles = new JComboBox();
				getContentPane().add(jcmbNiveles);
				{
					jlblNiveles = new JLabel();
					getContentPane().add(jlblNiveles);
					jlblNiveles.setText("Niveles");
					jlblNiveles.setFont(new java.awt.Font("DejaVu Sans",1,16));
					jlblNiveles.setBounds(184, 60, 74, 15);
				}
				{
					jbtnSalir = new JButton();
					getContentPane().add(jbtnSalir);
					jbtnSalir.setText("Salir");
					jbtnSalir.setBounds(330, 299, 73, 22);
				}
				jcmbNiveles.setModel(jcmbNivelesModel);
				jcmbNiveles.setBounds(155, 87, 131, 22);
			}

			pack();
			this.setSize(445, 376);
		} catch (Exception e) {
		    //add your error handling code here
			e.printStackTrace();
		}
	}
	
	public JButton getJbtnSalir() {
		return jbtnSalir;
	}

	public void setJbtnSalir(JButton jbtnSalir) {
		this.jbtnSalir = jbtnSalir;
	}

	public String getJcmbNiveles() {
		return jcmbNiveles.getSelectedItem().toString();
	}

	public void setJcmbNiveles(JComboBox jcmbNiveles) {
		this.jcmbNiveles = jcmbNiveles;
	}

	public void setResultados(AbstractTableModel abstractTableModel) {
		tblPuntuaciones.setModel(abstractTableModel);
	}
  
	 public void setCargarComboNivel(List niveles) {
		 ComboBoxModel jComboNivelModel =
			 new DefaultComboBoxModel(niveles.toArray());
		 jcmbNiveles.setModel(jComboNivelModel);
	 }
	 
		public void addListener(ActionListener actionListener) {
			this.jcmbNiveles.addActionListener(actionListener);
			this.jbtnSalir.addActionListener(actionListener);
	    }
}
